package www.ld.com.service;

import com.google.common.collect.Lists;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import www.ld.com.entities.Dept;

import java.util.List;
@Component
public class DeptServiceFallbackFactory implements FallbackFactory<IDeptService> {
    @Override
    public IDeptService create(Throwable throwable) {
        return new IDeptService() {
            @Override
            public List<Dept> findAll() {
                List<Dept>  temp    = Lists.newArrayList();
                temp.add(new Dept().setDbSource("no tables").setDname("停止该服务使用 ，请稍后重试"));
                return temp;
            }
        };
    }
}
